package com.scs.application.modules.finance.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.scs.application.core.entity.FlowEntity;
import com.scs.application.modules.upgrade.db.annotation.EntityClassAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityFieldAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityIndexAnnotation;
import com.scs.application.modules.upgrade.db.enums.EntityFieldType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
/**
 * <p>
 *
 * </p>
 */
@Data
@Accessors(chain = true)
@TableName("finance_bill")
@EntityIndexAnnotation(ux = {"bus_key"},
        ix = {"dept_id", "bus_date","flow_status","supplier_id","exec_dept_id","flag_supplier","flag_dept","flag_consignment","flag_omoc","account_check_id","account_check_status"}
)
@EntityClassAnnotation(remark = "记账表")
public class Bill extends FlowEntity {


    @EntityFieldAnnotation(
            text = "科室ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            comment = "计入成本的科室"
    )
    private String deptId;

    @EntityFieldAnnotation(
            text = "科室名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String deptName;

    @EntityFieldAnnotation(
            text = "供应商ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String supplierId;

    @EntityFieldAnnotation(
            text = "供应商名称",
            length = "100",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String supplierName;

    @EntityFieldAnnotation(
            text = "记账单号",
            length = "20",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String busKey;

    @EntityFieldAnnotation(
            text = "记账日期",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Date busDate;

    @EntityFieldAnnotation(
            text = "业务主办人",
            length = "20",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String busUser;

    @EntityFieldAnnotation(
            text = "业务主办人编码",
            length = "20",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String busUserCode;

    @EntityFieldAnnotation(
            text = "金额",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private Double amount;

    @EntityFieldAnnotation(
            text = "执行科室ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = "比如手术室，导管室"
    )
    private String execDeptId;

    @EntityFieldAnnotation(
            text = "执行科室名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String execDeptName;

    @EntityFieldAnnotation(
            text = "备注",
            length = "200",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String remark;

    @EntityFieldAnnotation(
            text = "是供应商账单",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Boolean flagSupplier;

    @EntityFieldAnnotation(
            text = "是科室账单",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Boolean flagDept;

    @EntityFieldAnnotation(
            text = "寄售入库标志1：寄售  （代销）0：非寄售（够销）入库需产生记帐单",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Boolean flagConsignment;

    @EntityFieldAnnotation(
            text = "一物一码入库标志1：一物一码0：非一物一码",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Boolean flagOmoc;


    @EntityFieldAnnotation(
            text = "",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = "扎账单id"
    )
    private String  accountCheckId;

    @EntityFieldAnnotation(
            text = "扎账单状态。start：未扎帐，end：已扎账",
            length = "10",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String  accountCheckStatus;

    // creator ,在父类中处理


    // gmt_create ,在父类中处理


    // modifier ,在父类中处理



    @EntityFieldAnnotation(
            text = "是否推送hrp",
            length = "",
            not_null = false,
            default_value = "false",
            comment = ""
    )
    private boolean flagSend;

    @EntityFieldAnnotation(
            text = "入账打印时间",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    public Date billPrintTime;

    @EntityFieldAnnotation(
            text = "入账是否打印",
            length = "",
            not_null = false,
            comment = "入账是否打印"
    )
    public Boolean billFlagPrint;

    @EntityFieldAnnotation(
            text = "消耗周期",
            length = "100",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String busDateCycle;




    @EntityFieldAnnotation(
            text = "原始业务数据id",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    @Deprecated  //过期，此字段为了兼容旧数据
    private String refBusId;

    @EntityFieldAnnotation(
            text = "原始业务类型",
            length = "",
            not_null = false,
            default_value = "",
            comment = "WorkOrder.busType"
    )
    @Deprecated  //过期，此字段为了兼容旧数据
    private String refBusType;

    @EntityFieldAnnotation(
            text = "原始业务表名称",
            length = "",
            not_null = false,
            default_value = "",
            comment = "小写"
    )
    @Deprecated  //过期，此字段为了兼容旧数据
    private String refBusTable;


    @EntityFieldAnnotation(
            text = "原始业务单号",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    @Deprecated  //过期，此字段为了兼容旧数据
    private String refBusKey;
}
